sysroot: Add an API to lock
authorColin Walters <walters@verbum.org>
Mon, 4 May 2015 22:35:52 +0000 (18:35 -0400)
committerColin Walters <walters@verbum.org>
Tue, 5 May 2015 12:52:44 +0000 (08:52 -0400)
commit9ef98fd05a335834b3ecb005d820be19784764d8
tree2ea2810444e05a64d29dd8b919d50a93a63c3334
parent33b06675976e5a353cff29bbf5622f7fd7565c27
sysroot: Add an API to lock

If a system administrator happens to type `ostree admin upgrade`
multiple times, currently that will lead to a potentially corrupted
system.

I originally attempted to do locking *internally* in `libostree`, but
that didn't work out because currently a number of the commands
perform multi-step operations that all need to be serialized.  All of
the current code in `ostree admin deploy` is an example.

Therefore, allow callers to perform locking, as most of the higher
level logic is presently implemented there.

At some point, we can revisit having internal locking, but it will be
difficult.  A more likely approach would be similar to Java's approach
with concurrency on iterators - a "fail fast" method.
Makefile-tests.am
doc/ostree-sections.txt
libglnx
src/libostree/ostree-sysroot-private.h
src/libostree/ostree-sysroot.c
src/libostree/ostree-sysroot.h
src/ostree/ot-admin-builtin-deploy.c
tests/test-admin-locking.sh [new file with mode: 0644]